<template>
  <div>
    <van-nav-bar
      title="精选专题"
      right-text="严选专栏"
      @click-right="onClickRight"
    />
    <div class="box">
      <div class="hd">
        <div v-for="item in list" :key="item">
          <div class="box1" @click="xiang(item.id)">
            <img :src="item.pic" /></div>
          <h5>{{item.title}}</h5>
          <p>{{item.descript}}</p>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    this.$API.zhuanti().then((res) => {
      this.list = res.data.data;
    });
  },
  methods: {
    onClickRight() {
      this.$router.push({ path: "/zhuanlan" });
    },
    xiang(id){
      this.$router.push({ path: "/xiang",query:{id:id}});
    }
  },
};
</script>
<style scoped>
.box {
  width: 100%;
  height: 240px;
  overflow: auto;
}
.hd {
  width: 413%;
  height: 240px;
  display: flex;
}
.box1 {
  width: 300px;
  height: 150px;
  border-radius: 6px;
  margin-left: 20px;
  margin-top: 20px;
}
.box1 img{
  width: 100%;
  height: 100%;
  border-radius: 6px;
}
h5,p{
  width: 300px;
  float: left;
  margin-left: 20px;
  white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
p{
  margin-top: -20px;
  margin-left: 20px;
  font-size: 10px;
  color:rgb(178,178,178);
}
</style>